//
//  Animal.cpp
//  test
//
//  Created by x86mac on 15-8-12.
//
//

#include "Animal.h"
#include "GameData.h"
USING_NS_CC;
Animal* Animal::createAnimal()
{
    SpriteFrameCache::getInstance()->addSpriteFramesWithFile("animal.plist");
    Animal* animal = new Animal();
    animal->mImageNumber = random(1,GameData::TOTAL_ANIMAL);
    animal->mCanRemove = false;
    char buff[64];
    snprintf(buff, 64, "a%d.png", animal->mImageNumber);
    animal->sprite = Sprite::createWithSpriteFrameName(buff);
    animal->addChild(animal->sprite);
    animal->sprite->setAnchorPoint(Point::ZERO);
    animal->autorelease();
    return animal;
}
bool Animal::Animal::init()
{
    if (!Layer::init()) 
    {
        return false;
    }
    return true;
}
float Animal::getContentWidth()
{
    return 60;
}